/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author chapmand
 */
@Entity
@Table(name = "DryHops")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DryHops.findAll", query = "SELECT d FROM DryHops d"),
    @NamedQuery(name = "DryHops.findByDryHopID", query = "SELECT d FROM DryHops d WHERE d.dryHopID = :dryHopID"),
    @NamedQuery(name = "DryHops.findByDryHopDays", query = "SELECT d FROM DryHops d WHERE d.dryHopDays = :dryHopDays"),
    @NamedQuery(name = "DryHops.findByDryHopLbs", query = "SELECT d FROM DryHops d WHERE d.dryHopLbs = :dryHopLbs")})
public class DryHops implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "dryHopID")
    private Integer dryHopID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "dryHopDays")
    private int dryHopDays;
    @Basic(optional = false)
    @NotNull
    @Column(name = "dryHopLbs")
    private float dryHopLbs;
    @JoinColumn(name = "hopID", referencedColumnName = "HID", nullable=true)
    @ManyToOne(optional = true)
    private Hops hopID;

    public DryHops() {
    }

    public DryHops(Integer dryHopID) {
        this.dryHopID = dryHopID;
    }

    public DryHops(Integer dryHopID, int dryHopDays, float dryHopLbs) {
        this.dryHopID = dryHopID;
        this.dryHopDays = dryHopDays;
        this.dryHopLbs = dryHopLbs;
    }

    public Integer getDryHopID() {
        return dryHopID;
    }

    public void setDryHopID(Integer dryHopID) {
        this.dryHopID = dryHopID;
    }

    public int getDryHopDays() {
        return dryHopDays;
    }

    public void setDryHopDays(int dryHopDays) {
        this.dryHopDays = dryHopDays;
    }

    public float getDryHopLbs() {
        return dryHopLbs;
    }

    public void setDryHopLbs(float dryHopLbs) {
        this.dryHopLbs = dryHopLbs;
    }

    public Hops getHopID() {
        return hopID;
    }

    public void setHopID(Hops hopID) {
        this.hopID = hopID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (dryHopID != null ? dryHopID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DryHops)) {
            return false;
        }
        DryHops other = (DryHops) object;
        if ((this.dryHopID == null && other.dryHopID != null) || (this.dryHopID != null && !this.dryHopID.equals(other.dryHopID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.DryHops[ dryHopID=" + dryHopID + " ]";
    }
    
}
